<template>
	<view class="warp">
		<view class="body">
			<c-navBar title="报名成功" isSeat> </c-navBar>
			<view class="content">
				<image style="width: 200rpx; height: 200rpx;" src="../static/success-icon.png" mode=""></image>
				<p class="content-p1">报名成功</p>
				<p class="content-p2">{{backTime}}s后自动返回</p>
				<view class="content-box" @click="goBack">
					返回
				</view>
				<p class="content-p3" @click="goOrderDetails">查看活动</p>

			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//3s返回首页
				backTime: 3,
				id: '', //活动id
				timer: null

			}
		},
		onLoad(e) {
			// console.log(e, "eeeeee");
			this.id = e.id
			this.goHome()

		},
		destroyed() {
			clearInterval(this.timer)
		},
		methods: {
			// 返回首页
			goBack() {
				uni.switchTab({
					url: '/pages/tabbar/home'
				})
			},

			//3s返回首页
			goHome() {
				this.timer = setInterval(() => {
					this.backTime--
					if (this.backTime === -1) {
						clearInterval(this.timer)
						uni.switchTab({
							url: '/pages/tabbar/home'
						})
					}
				}, 1000)

			},
			// 查看活动
			goOrderDetails() {
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.warp {
		width: 100vw;
		min-height: 100vh;
		background-color: #FFFFFF;

	}

	.body {
		width: 750rpx;
		height: 320rpx;
	}

	.content {
		// width: 400rpx;
		margin: 0 auto;
		padding-top: 300rpx;
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		align-items: center;

		.content-p1 {
			font-size: 36rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: bold;
			color: #1A1A1A;
			margin-top: 32rpx;
		}

		.content-p2 {
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #999999;
			margin: 40rpx 0rpx;
		}

		.content-box {
			width: 400rpx;
			height: 88rpx;
			background: linear-gradient(135deg, #2AD03D 0%, #00B815 100%);
			border-radius: 16rpx 16rpx 16rpx 16rpx;
			font-size: 36rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			color: #FFFFFF;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.content-p3 {
			font-size: 28rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			color: #666666;
			margin-top: 28rpx;
		}

	}
</style>